<template>
  <div>
    <div class="wxcode">
      <div class="gongzhonghao" style="width: 30%; display: inline-block; float: left">
        <div style="float: left">
          <div style="height: 20px; line-height: 20px; text-align: center">企业微信</div>
          <img style="height: 80px" src="http://eim.kejicloud.com/images/plqywx.png" />
        </div>
      </div>
    </div>

    <j-modal
      :title="title"
      :width="width"
      :visible="visible"
      :mask="false"
      :keyboard="false"
      :closable="false"
      :maskClosable="false"
      :confirmLoading="confirmLoading"
      @ok="handleOk"
      @cancel="handleCancel"
      :ok-button-props="{ props: { disabled: disableSubmit } }"
      cancelText="关闭"
    >
      <template slot="footer">
        <a-button @click="handleCancel">关闭</a-button>
        <a-button v-if="!disableSubmit" type="primary" @click="handleOk" :loading="buttonok">确定</a-button>
      </template>
      <a-spin :spinning="confirmLoading">
        <a-form :form="form">
          <a-descriptions title="个人信息">
            <a-row>
              <a-col :span="8">
                <a-form-item label="花名册" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-search-select-tag
                    :disabled="disableSubmit"
                    @change="selectWxUserId"
                    v-decorator="['wxUserId']"
                    dict="HrWxUser,name,userId,"
                    otherField="mobile,gender,email,avatar,thumbAvatar,position,telephone,alias,address,englishName"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="员工姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['name', validatorRules.name]"
                    placeholder="请输入员工姓名"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="英文名" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['nameEn', validatorRules.nameEn]"
                    placeholder="请输入英文名"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="身份证" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    @blur.native="getBirthday"
                    v-decorator="['idCard', validatorRules.idCard]"
                    placeholder="请输入身份证"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="年龄" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number
                    :disabled="disableSubmit"
                    :min="0"
                    v-decorator="['age', validatorRules.age]"
                    placeholder="请输入年龄"
                    style="width: 100%"
                  ></a-input-number>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    :disabled="disableSubmit"
                    type="list"
                    v-decorator="['gender', validatorRules.gender]"
                    :trigger-change="true"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId =USER_SEX"
                    placeholder="请选择性别"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="出生日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date
                    :disabled="disableSubmit"
                    placeholder="请选择出生日期"
                    v-decorator="['birthday', validatorRules.birthday]"
                    :trigger-change="true"
                    style="width: 100%"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="民族" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-search-select-tag
                    :disabled="disableSubmit"
                    v-decorator="['nationId', validatorRules.nationId]"
                    dict="DataDictionary,description,dictionaryCode, dictionaryTypeId =ETHNICITY"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="婚姻状况" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    :disabled="disableSubmit"
                    type="list"
                    v-decorator="['wedlock', validatorRules.wedlock]"
                    :trigger-change="true"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId =EMP_MARITAL_STATUS"
                    placeholder="请选择婚姻状况"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="政治面貌" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    :disabled="disableSubmit"
                    type="list"
                    v-decorator="['politicId']"
                    :trigger-change="true"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId =EMP_PARTY"
                    placeholder="请选择政治面貌"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="籍贯" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['nativePlace', validatorRules.nativePlace]"
                    placeholder="请输入籍贯"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="户籍类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    :disabled="disableSubmit"
                    type="list"
                    v-decorator="['household']"
                    :trigger-change="true"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId =HOUSEHOLD"
                    placeholder="请选择户籍类型"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="户籍所在地" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['householdLocation', validatorRules.householdLocation]"
                    placeholder="请输入户籍所在地"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="电话号码" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['phone', validatorRules.phone]"
                    placeholder="请输入电话号码"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="公司邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['companyEmail', validatorRules.email]"
                    placeholder="请输入公司邮箱"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="入职前工龄" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number
                    style="width: 100%"
                    :disabled="disableSubmit"
                    :min="0"
                    :step="0.1"
                    v-decorator="['workAge', validatorRules.workAge]"
                    placeholder="请输入入职前工龄"
                  ></a-input-number>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="个人邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['email', validatorRules.email]"
                    placeholder="请输入个人邮箱"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="联系地址" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['address', validatorRules.address]"
                    placeholder="请输入联系地址"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="邮编" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['postCode', validatorRules.postCode]"
                    placeholder="请输入邮编"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="紧急联系人" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['emergencyContact', validatorRules.emergencyContact]"
                    placeholder="请输入紧急联系人"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="联系人关系" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['contactRelationship', validatorRules.contactRelationship]"
                    placeholder="请输入联系人关系"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="联系人电话" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['contactNumber', validatorRules.contactNumber]"
                    placeholder="请输入联系人电话"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="最高学历" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    :disabled="disableSubmit"
                    type="list"
                    @change="changeUpload"
                    v-decorator="['tiptopDegree', validatorRules.tiptopDegree]"
                    :trigger-change="true"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId = EMP_EDUCATION"
                    placeholder="请选择最高学历"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="bengke">
                <a-form-item label="所属专业" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['specialty', bengke ? validatorRules.specialty : {}]"
                    placeholder="请输入所属专业"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="bengke">
                <a-form-item label="毕业院校" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['school', bengke ? validatorRules.school : {}]"
                    placeholder="请输入毕业院校"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="education">
                <a-form-item label="研究生所属专业" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['masterSpecialty', education ? validatorRules.masterSpecialty : {}]"
                    placeholder="请输入所学专业"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="education">
                <a-form-item label="研究生毕业院校" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['masterSchool', education ? validatorRules.masterSchool : {}]"
                    placeholder="请输入毕业院校"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="银行卡号" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['bankCard', validatorRules.bankCard]"
                    placeholder="请输入银行卡号"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="开户行" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['bankOfDeposit', validatorRules.bankOfDeposit]"
                    placeholder="请输入开户行"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="职称" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input :disabled="disableSubmit" v-decorator="['jobLevel']" placeholder="请输职称"></a-input>
                  <!-- <j-dict-select-tag
                :disabled="disableSubmit"
                type="list"
                v-decorator="['jobLevel', validatorRules.jobLevel]"
                :trigger-change="true"
                dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId =JOB_LEVEL"
                placeholder="请选择职称"
              /> -->
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="内部推荐人" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input :disabled="disableSubmit" v-decorator="['referrer']" placeholder="请输内部推荐人"></a-input>
                </a-form-item>
              </a-col>
            </a-row>
          </a-descriptions>

          <a-descriptions title="工作信息">
            <a-row>
              <a-col :span="8">
                <a-form-item label="合同关系公司" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    type="list"
                    v-decorator="['companyName', validatorRules.companyName]"
                    :trigger-change="true"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId =PARTNER_COM_TYPE"
                    placeholder="请选择合同关系公司"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="聘用形式" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    :disabled="disableSubmit"
                    type="list"
                    v-decorator="['engageForm', validatorRules.engageForm]"
                    :trigger-change="true"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId =WORK_TYPE"
                    placeholder="请选择聘用形式"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="员工分类" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    :disabled="disableSubmit"
                    type="list"
                    v-decorator="['categoryId', validatorRules.categoryId]"
                    :trigger-change="true"
                    @change="changeUpload"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId =STAFF_SORT"
                    placeholder="请选择员工分类"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="是否管培生" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    :disabled="disableSubmit"
                    type="list"
                    v-decorator="['isGuanPeiSheng', validatorRules.isGuanPeiSheng]"
                    :trigger-change="true"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId = BOOL_DEFINE"
                    placeholder="请选择"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="管培生届数" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    :disabled="disableSubmit"
                    type="list"
                    v-decorator="['GuanPeiShengYear']"
                    :trigger-change="true"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId = GUANPEISHENG_YEAR"
                    placeholder="请选择"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="所属部门" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-category-select
                    :disabled="disableSubmit"
                    v-decorator="['departmentId', validatorRules.departmentId]"
                    pcode="{table:'HrDepartment',txt:'name',key:'departmentId',idField:'id',pidField:'parentId',hasChildField:'hasChild', condition:' parentId = 0'}"
                    placeholder="请选择所属部门"
                    back="title"
                    @change="handleCategoryChange"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="职级" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    :disabled="disableSubmit"
                    type="list"
                    v-decorator="['positionRank', validatorRules.positionRank]"
                    :trigger-change="true"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId =POSITION_RANK"
                    placeholder="请选择职级"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="现任岗位" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['positionName', validatorRules.positionName]"
                    placeholder="请输入现任岗位"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="直属上级" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['reportTo', validatorRules.reportTo]"
                    placeholder="请输入直属上级"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="工作地点" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input
                    :disabled="disableSubmit"
                    v-decorator="['workAddress', validatorRules.workAddress]"
                    placeholder="请输入工作地点"
                  ></a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="员工状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-dict-select-tag
                    :disabled="disableSubmit"
                    type="list"
                    v-decorator="['workState', validatorRules.workState]"
                    :trigger-change="true"
                    dictCode="DataDictionary,description,dictionaryCode, dictionaryTypeId =EMP_WORK_STATE"
                    placeholder="请选择员工状态"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="入司日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date
                    :disabled="disableSubmit"
                    placeholder="请选择入司日期"
                    @change="getConversionTime"
                    v-decorator="['beginDate', validatorRules.beginDate]"
                    :trigger-change="true"
                    style="width: 100%"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="转正日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date
                    :disabled="disableSubmit"
                    placeholder="请选择转正日期"
                    v-decorator="['conversionTime', validatorRules.conversionTime]"
                    :trigger-change="true"
                    style="width: 100%"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="离职日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date
                    :disabled="disableSubmit"
                    placeholder="请选择离职日期"
                    v-decorator="['notWorkDate']"
                    :trigger-change="true"
                    style="width: 100%"
                  />
                </a-form-item>
              </a-col>
              <!-- <a-col :span="8">
            <a-form-item label="工号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="disableSubmit" v-decorator="['workId', validatorRules.workId]" placeholder="请输入工号"></a-input>
            </a-form-item>
          </a-col> -->
              <a-col :span="8">
                <a-form-item label="合同期限(月)" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input-number
                    :disabled="disableSubmit"
                    :min="1"
                    @change="changeEndContract"
                    v-decorator="['contTerm', validatorRules.contTerm]"
                    placeholder="请输入合同期"
                    style="width: 100%"
                  ></a-input-number>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="合同起始日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date
                    :disabled="disableSubmit"
                    placeholder="请选择合同起始日期"
                    @change="getEndContract"
                    v-decorator="['beginContract', validatorRules.beginContract]"
                    :trigger-change="true"
                    style="width: 100%"
                  />
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="合同终止日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-date
                    :disabled="true"
                    placeholder="请选择合同终止日期"
                    v-decorator="['endContract', validatorRules.endContract]"
                    :trigger-change="true"
                    style="width: 100%"
                  />
                </a-form-item>
              </a-col>

              <!-- <a-col :span="8">
            <a-form-item label="预计入职日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date
                :disabled="disableSubmit"
                placeholder="请选择预计入职日期"
                v-decorator="['estimateBeginDate']"
                :trigger-change="true"
                style="width: 100%"
              />
            </a-form-item>
          </a-col> -->
            </a-row>
          </a-descriptions>

          <a-descriptions title="资料上传">
            <a-row>
              <a-col :span="8" v-show="modellist.indexOf('eduPath') > -1">
                <a-form-item label="学历证书" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="['eduPath', modellist.indexOf('eduPath') > -1 ? validatorRules.eduPath : {}]"
                  ></j-image-upload>
                </a-form-item>
              </a-col>

              <a-col :span="8" v-show="modellist.indexOf('degreePath') > -1">
                <a-form-item label="学位证书" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="['degreePath', modellist.indexOf('degreePath') > -1 ? validatorRules.degreePath : {}]"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="modellist.indexOf('eduValidatePath') > -1">
                <a-form-item label="学历验证报告" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="[
                      'eduValidatePath',
                      modellist.indexOf('eduValidatePath') > -1 ? validatorRules.eduValidatePath : {},
                    ]"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="modellist.indexOf('eduMasterPath') > -1">
                <a-form-item label="硕士学历证书" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="[
                      'eduMasterPath',
                      modellist.indexOf('eduMasterPath') > -1 ? validatorRules.eduMasterPath : {},
                    ]"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="modellist.indexOf('degreemasterPath') > -1">
                <a-form-item label="硕士学位证书" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="[
                      'degreemasterPath',
                      modellist.indexOf('degreemasterPath') > -1 ? validatorRules.degreemasterPath : {},
                    ]"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="身份证国徽面" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="['idCard1Path', validatorRules.idCard1Path]"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="身份证人像面" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="['idCard2Path', validatorRules.idCard2Path]"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="modellist.indexOf('resignLetterPath') > -1">
                <a-form-item label="前公司离职证明" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="['resignLetterPath']"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="modellist.indexOf('xuexinEduPath') > -1">
                <a-form-item label="本科学历认证" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="[
                      'xuexinEduPath',
                      modellist.indexOf('xuexinEduPath') > -1 ? validatorRules.xuexinEduPath : {},
                    ]"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="modellist.indexOf('xuexinEduMasterPath') > -1">
                <a-form-item label="研究生学历认证" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="[
                      'xuexinEduMasterPath',
                      modellist.indexOf('xuexinEduMasterPath') > -1 ? validatorRules.xuexinEduMasterPath : {},
                    ]"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="modellist.indexOf('lifePhoto') > -1">
                <a-form-item label="生活照" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="['lifePhoto', modellist.indexOf('lifePhoto') > -1 ? validatorRules.lifePhoto : {}]"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8" v-show="modellist.indexOf('workPhoto') > -1">
                <a-form-item label="证件照" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="['workPhoto', modellist.indexOf('workPhoto') > -1 ? validatorRules.workPhoto : {}]"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="四级证书" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="['cet4Path']"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="六级证书" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="['cet6Path']"
                  ></j-image-upload>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label="其他证书" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <j-image-upload
                    :disabled="disableSubmit"
                    :isMultiple="false"
                    v-decorator="['otherEduPath']"
                  ></j-image-upload>
                </a-form-item>
              </a-col>

              <a-form-item v-show="false">
                <a-input :disabled="disableSubmit" v-decorator="['name']"></a-input>
              </a-form-item>
            </a-row>
          </a-descriptions>
        </a-form>
      </a-spin>
    </j-modal>

    <a-result
      v-if="!visible && isOk"
      style="backgroundcolor: #fff; border-radius: 10px; opacity: 0.8"
      status="success"
      title="提交员工信息成功！"
    >
    </a-result>
    <a-result
      v-if="!visible && !isOk"
      style="backgroundcolor: #fff; border-radius: 10px; opacity: 0.8"
      status="success"
      title="这条数据不允许员工自行编辑！"
    >
    </a-result>
  </div>
</template>

<script>
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
import { validateDuplicateValue } from '@/utils/util'
import JDate from '@/components/jeecg/JDate'
import JUpload from '@/components/jeecg/JUpload'
import JImageUpload from '@/components/jeecg/JImageUpload'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
import JCategorySelect from '@/components/jeecg/JCategorySelect'

export default {
  name: 'HrEmployeeModal',
  components: {
    JDate,
    JUpload,
    JImageUpload,
    JDictSelectTag,
    JSearchSelectTag,
    JCategorySelect,
  },
  data() {
    return {
      form: this.$form.createForm(this),
      title: '普冷国际员工信息',
      width: 1200,
      visible: true,
      isOk: true,
      buttonok: false,
      bengke: false,
      education: false,
      isStaffAddFlag: false,
      modellist: [],
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 8 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      confirmLoading: false,
      disableSubmit: false,
      validatorRules: {
        wxUserId: {
          rules: [{ required: true, message: '请输入花名册的ID!' }],
        },
        typeId: {
          rules: [{ required: true, message: '请输入类型!' }],
        },
        name: {
          rules: [{ required: true, message: '请输入员工姓名!' }],
        },
        nameEn: {
          rules: [{ required: true, message: '请输入英文名!' }],
        },
        age: {
          rules: [{ required: true, message: '请输入年龄!' }],
        },
        /* nameEn: {
           rules: [
           { required: true, message: '请输入英文名!'},
           ]
           }, */
        gender: {
          rules: [{ required: true, message: '请输入性别!' }],
        },
        /* birthday: {
           rules: [
           { required: true, message: '请输入出生日期!'},
           ]
           }, */
        idCard: {
          rules: [{ required: true, message: '请输入身份证!' }],
        },
        /* wedlock: {
           rules: [
           { required: true, message: '请输入婚姻状况!'},
           ]
           }, */
        nationId: {
          rules: [{ required: true, message: '请输入民族!' }],
        },
        nativePlace: {
          rules: [{ required: true, message: '请输入籍贯!' }],
        },
        email: {
          rules: [
            { required: true, message: '请输入邮箱!' },
            { pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!' },
          ],
        },
        phone: {
          rules: [
            { required: true, message: '请输入电话号码!' },
            { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!' },
          ],
        },
        departmentId: {
          rules: [{ required: true, message: '请输入所属部门!' }],
        },
        jobLevel: {
          rules: [{ required: true, message: '请输入职称ID!' }],
        },

        companyName: {
          rules: [{ required: true, message: '请输入合作关系公司!' }],
        },
        categoryId: {
          rules: [{ required: true, message: '请选择员工分类!' }],
        },
        positionName: {
          rules: [{ required: true, message: '请输入现任岗位!' }],
        },
        reportTo: {
          rules: [{ required: true, message: '请输入直属上级!' }],
        },
        workAddress: {
          rules: [{ required: true, message: '请输入工作地点!' }],
        },
        address: {
          rules: [{ required: true, message: '请输入联系地址!' }],
        },
        postCode: {
          rules: [{ required: true, message: '请输入邮编!' }],
        },
        emergencyContact: {
          rules: [{ required: true, message: '请输入紧急联系人!' }],
        },
        contactRelationship: {
          rules: [{ required: true, message: '请输入联系人关系!' }],
        },
        contactNumber: {
          rules: [{ required: true, message: '请输入联系人电话!' }],
        },

        positionRank: {
          rules: [{ required: true, message: '请选择职级!' }],
        },
        engageForm: {
          rules: [{ required: true, message: '请输入聘用形式!' }],
        },
        tiptopDegree: {
          rules: [{ required: true, message: '请输入最高学历!' }],
        },
        specialty: {
          rules: [{ required: true, message: '请输入本科所属专业!' }],
        },
        school: {
          rules: [{ required: true, message: '请输入本科毕业院校!' }],
        },
        masterSpecialty: {
          rules: [{ required: true, message: '请输入研究生所属专业!' }],
        },
        masterSchool: {
          rules: [{ required: true, message: '请输入研究生毕业院校!' }],
        },
        workAge: {
          rules: [{ required: true, message: '请输入工龄!' }],
        },
        beginDate: {
          rules: [{ required: true, message: '请输入入司日期!' }],
        },
        workState: {
          rules: [{ required: true, message: '请输入员工状态!' }],
        },
        isGuanPeiSheng: {
          rules: [{ required: true, message: '请选择是否管培生!' }],
          initialValue: 'N',
        },
        /* workID: {
           rules: [
           { required: true, message: '请输入工号!'},
           ]
           }, */
        contTerm: {
          rules: [{ required: true, message: '请输入合同期限!' }],
          initialValue: 12,
        },
        conversionTime: {
          rules: [{ required: true, message: '请选择转正日期!' }],
        },
        beginContract: {
          rules: [{ required: true, message: '请输入合同起始日期!' }],
        },
        endContract: {
          rules: [{ required: true, message: '请输入合同终止日期!' }],
        },
        household: {
          rules: [{ required: true, message: '请输入户籍类型!' }],
        },
        householdLocation: {
          rules: [{ required: true, message: '请输入户籍所在地!' }],
        },
        estimateBeginDate: {
          rules: [{ required: true, message: '请输入预计入职日期!' }],
        },
        bankCard: {
          rules: [{ required: true, message: '请输入银行卡号!' }],
        },
        bankOfDeposit: {
          rules: [{ required: true, message: '请输入开户行!' }],
        },
        contactNumber: {
          rules: [
            { required: true, message: '请输入联系人电话!' },
            { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!' },
          ],
        },
        eduPath: {
          rules: [{ required: true, message: '请上传学历证书!' }],
        },
        degreePath: {
          rules: [{ required: true, message: '请上传学位证书!' }],
        },
        eduValidatePath: {
          rules: [{ required: true, message: '请上传学历验证报告!' }],
        },
        idCard1Path: {
          rules: [{ required: true, message: '请上传身份证（国徽面）!' }],
        },
        idCard2Path: {
          rules: [{ required: true, message: '请上传身份证（人像面）!' }],
        },
        resignLetterPath: {
          rules: [{ required: true, message: '请上传前公司离职证明!' }],
        },
        cet4Path: {
          rules: [{ required: true, message: '请上传四级证书!' }],
        },
        cet6Path: {
          rules: [{ required: true, message: '请上传六级证书!' }],
        },
        otherEduPath: {
          rules: [{ required: true, message: '请上传其他证书!' }],
        },
        xuexinEduPath: {
          rules: [{ required: true, message: '请上传学信网本科学历认证!' }],
        },
        lifePhoto: {
          rules: [{ required: true, message: '请上传生活照!' }],
        },
        workPhoto: {
          rules: [{ required: true, message: '请上传证件照!' }],
        },
        eduMasterPath: {
          rules: [{ required: true, message: '请上传硕士学历证书!' }],
        },
        degreemasterPath: {
          rules: [{ required: true, message: '请上传硕士学位证书!' }],
        },
        xuexinEduMasterPath: {
          rules: [{ required: true, message: '请上传学信网研究生学历认证!' }],
        },
      },
      url: {
        save: '/online/saveSimpleHrEmployee',
        get: '/online/getSimpleHrEmployee',
      },
    }
  },
  created() {
    let id = this.$route.query.id
    this.init(id)
  },
  methods: {
    init(id) {
      this.modellist = []
      this.form.resetFields()
      this.model = {}
      if (id) {
        httpAction(this.url.get, { partyId: id }, 'post').then((res) => {
          let result = res.result
          if (result.isStaffAdd) {
            if (result.isStaffAdd == 'N') {
              this.visible = false
              this.isOk = false
            }
          }
          this.model = Object.assign({}, result)
          this.$nextTick(() => {
            this.form.setFieldsValue(
              pick(
                this.model,
                'wxUserId',
                'name',
                'nameEn',
                'gender',
                'age',
                'birthday',
                'idCard',
                'wedlock',
                'nationId',
                'nativePlace',
                'politicId',
                'email',
                'phone',
                'companyEmail',
                'address',
                'postCode',
                'departmentId',
                'positionRank',
                'positionName',
                'jobLevel',
                'referrer',
                'engageForm',
                'categoryId',
                'isGuanPeiSheng',
                'GuanPeiShengYear',
                'tiptopDegree',
                'specialty',
                'school',
                'masterSpecialty',
                'masterSchool',
                'eduPath',
                'workAge',
                'beginDate',
                'workState',
                'workId',
                'companyName',
                'contTerm',
                'conversionTime',
                'notWorkDate',
                'beginContract',
                'endContract',
                'uploadPath',
                'household',
                'householdLocation',
                'workAddress',
                'reportTo',
                'estimateBeginDate',
                'bankCard',
                'bankOfDeposit',
                'emergencyContact',
                'contactRelationship',
                'contactNumber',
                'degreePath',
                'eduValidatePath',
                'eduMasterPath',
                'degreemasterPath',
                'eduValidatemasterPath',
                'idCard1Path',
                'idCard2Path',
                'resignLetterPath',
                'cet4Path',
                'cet6Path',
                'otherEduPath',
                'xuexinEduPath',
                'xuexinEduMasterPath',
                'lifePhoto',
                'workPhoto'
              )
            )
            this.changeUpload()
          })
        })
      }
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      const that = this
      httpAction(this.url.get, { partyId: this.$route.query.id }, 'post').then((res) => {
        let result = res.result
        if (result.isStaffAdd == 'N') {
          that.$message.error('不能修改信息！请联系HR')
        } else {
          // 触发表单验证
          this.form.validateFields((err, values) => {
            if (!err) {
              that.confirmLoading = true
              that.buttonok = true
              let httpurl = this.url.save
              let method = 'post'
              let formData = Object.assign(this.model, values)
              formData.typeId = 'EMPLOYEE'
              console.log('表单提交数据', formData)
              httpAction(httpurl, formData, method)
                .then((res) => {
                  that.$message.success('提交成功！')
                  that.$emit('ok')
                  setTimeout(() => {
                    that.buttonok = false
                  }, 500)
                })
                .finally(() => {
                  that.confirmLoading = false
                  that.close()
                })
            }
          })
        }
      })
    },
    handleCancel() {
      this.close()
    },
    popupCallback(row) {
      this.form.setFieldsValue(
        pick(
          row,
          'wxUserId',
          'name',
          'nameEn',
          'gender',
          'age',
          'birthday',
          'idCard',
          'wedlock',
          'nationId',
          'nativePlace',
          'politicId',
          'email',
          'phone',
          'companyEmail',
          'address',
          'postCode',
          'departmentId',
          'positionRank',
          'positionName',
          'jobLevel',
          'referrer',
          'engageForm',
          'categoryId',
          'isGuanPeiSheng',
          'GuanPeiShengYear',
          'tiptopDegree',
          'specialty',
          'school',
          'eduPath',
          'masterSpecialty',
          'masterSchool',
          'workAge',
          'beginDate',
          'workState',
          'workId',
          'companyName',
          'contTerm',
          'conversionTime',
          'notWorkDate',
          'beginContract',
          'endContract',
          'uploadPath',
          'household',
          'householdLocation',
          'workAddress',
          'reportTo',
          'estimateBeginDate',
          'bankCard',
          'bankOfDeposit',
          'emergencyContact',
          'contactRelationship',
          'contactNumber',
          'degreePath',
          'eduValidatePath',
          'eduMasterPath',
          'degreemasterPath',
          'eduValidatemasterPath',
          'idCard1Path',
          'idCard2Path',
          'resignLetterPath',
          'cet4Path',
          'cet6Path',
          'otherEduPath',
          'xuexinEduPath',
          'xuexinEduMasterPath',
          'lifePhoto',
          'workPhoto'
        )
      )
    },
    handleCategoryChange(value, backObj) {
      this.form.setFieldsValue(backObj)
    },
    selectWxUserId(val, row) {
      console.log(val,row)
      httpAction(this.url.uniquePersonWxUserId, { wxUserId: val }, 'post').then((res) => {
        if (res.success) {
          if (res.result.uniqueWxUserId == 'N') {
            this.$nextTick(() => {
              this.form.resetFields('wxUserId')
            })
            this.$message.warning('此花名册ID已绑定！')
          } else {
            this.model.mobile = row.mobile
            this.model.logoImageUrl = row.avatar
            this.model.nickName = row.alias
            this.visible = true
            let fieldval = pick(this.model, 'name', 'nameEn', 'mobile', 'address', 'email', 'logoImageUrl', 'nickName')
            this.$nextTick(() => {
              this.form.setFieldsValue(fieldval)
            })
          }
        }
      })
    },
    changeUpload() {
      this.$nextTick(() => {
        let tiptopDegree = parseInt(this.form.getFieldValue('tiptopDegree'))
        let categoryId = parseInt(this.form.getFieldValue('categoryId'))
        if (tiptopDegree == 5) {
          this.bengke = true
          this.education = false
        }
        if (tiptopDegree > 5) {
          this.bengke = true
          this.education = true
        }
        if (tiptopDegree < 5) {
          this.bengke = false
          this.education = false
        }
        if (categoryId == 8) {
          this.modellist = ['idCard1Path', 'idCard2Path', 'cet4Path', 'cet6Path', 'otherEduPath']
        }
        if (categoryId == 9) {
          this.modellist = ['idCard1Path', 'idCard2Path', 'cet4Path', 'cet6Path', 'otherEduPath']
        }
        if (categoryId == 10) {
          this.modellist = ['idCard1Path', 'idCard2Path', 'cet4Path', 'cet6Path', 'otherEduPath']
        } else if (tiptopDegree < 5 && categoryId == 11) {
          this.modellist = [
            'idCard1Path',
            'idCard2Path',
            'cet4Path',
            'cet6Path',
            'otherEduPath',
            'eduPath',
            'resignLetterPath',
            'lifePhoto',
            'workPhoto',
          ]
        } else if (tiptopDegree == 5 && categoryId == 11) {
          this.modellist = [
            'idCard1Path',
            'idCard2Path',
            'cet4Path',
            'cet6Path',
            'otherEduPath',
            'eduPath',
            'degreePath',
            'resignLetterPath',
            'lifePhoto',
            'workPhoto',
          ]
        } else if (tiptopDegree > 5 && categoryId == 11) {
          this.modellist = [
            'idCard1Path',
            'idCard2Path',
            'cet4Path',
            'cet6Path',
            'otherEduPath',
            'eduPath',
            'degreePath',
            'resignLetterPath',
            'lifePhoto',
            'workPhoto',
            'eduMasterPath',
            'degreemasterPath',
          ]
        } else if (tiptopDegree < 5 && categoryId < 3) {
          this.modellist = [
            'idCard1Path',
            'idCard2Path',
            'cet4Path',
            'cet6Path',
            'otherEduPath',
            'eduPath',
            'resignLetterPath',
            'lifePhoto',
            'workPhoto',
          ]
        } else if (tiptopDegree == 5 && categoryId < 3) {
          this.modellist = [
            'idCard1Path',
            'idCard2Path',
            'cet4Path',
            'cet6Path',
            'otherEduPath',
            'eduPath',
            'degreePath',
            'resignLetterPath',
            'lifePhoto',
            'workPhoto',
          ]
        } else if (tiptopDegree > 5 && categoryId < 3) {
          this.modellist = [
            'idCard1Path',
            'idCard2Path',
            'cet4Path',
            'cet6Path',
            'otherEduPath',
            'eduPath',
            'degreePath',
            'resignLetterPath',
            'lifePhoto',
            'workPhoto',
            'eduMasterPath',
            'degreemasterPath',
          ]
        } else if (tiptopDegree < 5 && categoryId > 2 && categoryId < 8) {
          this.modellist = [
            'idCard1Path',
            'idCard2Path',
            'cet4Path',
            'cet6Path',
            'otherEduPath',
            'eduPath',
            'lifePhoto',
            'workPhoto',
            'xuexinEduPath',
          ]
        } else if (tiptopDegree == 5 && categoryId > 2 && categoryId < 8) {
          this.modellist = [
            'idCard1Path',
            'idCard2Path',
            'cet4Path',
            'cet6Path',
            'otherEduPath',
            'eduPath',
            'degreePath',
            'lifePhoto',
            'workPhoto',
            'xuexinEduPath',
          ]
        } else if (tiptopDegree > 5 && categoryId > 2 && categoryId < 8) {
          this.modellist = [
            'idCard1Path',
            'idCard2Path',
            'cet4Path',
            'cet6Path',
            'otherEduPath',
            'eduPath',
            'degreePath',
            'lifePhoto',
            'workPhoto',
            'eduMasterPath',
            'degreemasterPath',
            'xuexinEduPath',
            'xuexinEduMasterPath',
          ]
        }
        // 当选择 实习生 派遣工 临时工 时，转正日期为非必填
        console.log(categoryId)
        if (categoryId == 8 || categoryId == 9 || categoryId == 10) {
          this.$delete(this.validatorRules, 'conversionTime')
        } else {
          this.$set(this.validatorRules, 'conversionTime', { rules: [{ required: true, message: '请选择转正日期!' }] })
        }
      })
    },
    getBirthday(e) {
      let id = e.target.value
      if (id.length == 18) {
        if (id[16] % 2 == 0) {
          this.form.setFieldsValue({
            gender: '0',
          })
        } else {
          this.form.setFieldsValue({
            gender: '1',
          })
        }
        let year = id.substr(6, 4)
        let month = id.substr(10, 2)
        let day = id.substr(12, 2)
        let birthday = year + '-' + month + '-' + day
        this.form.setFieldsValue({
          birthday: birthday,
        })
        this.form.setFieldsValue({
          age: this.ages(birthday),
        })
      }
    },
    ages(str) {
      let r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/)
      if (r == null) return false
      let d = new Date(r[1], r[3] - 1, r[4])
      if (d.getFullYear() == r[1] && d.getMonth() + 1 == r[3] && d.getDate() == r[4]) {
        let Y = new Date().getFullYear()
        let M = new Date().getMonth() + 1
        let D = new Date().getDate()
        let age = Y - r[1]
        if (M == r[3]) {
          let dayDiff = D - r[4] //
          if (dayDiff > 0) {
            age = age + 1
          }
        } else {
          let monthDiff = M - r[3] //
          if (monthDiff < 0) {
            age = age - 1
          }
        }
        return age
      }
      return '输入的日期格式错误！'
    },
    getConversionTime(e) {
      let year = e.substr(0, 4)
      let day = e.substr(8, 2)
      let strMonthA = e.substr(5, 1)
      let strMonthB = e.substr(6, 1)
      let numMonthB = Number(strMonthB)
      let numMonthA = Number(strMonthA)
      let numberYear = Number(year)
      if (numMonthA == 0) {
        if (numMonthB + 6 > 12) {
          numberYear = numberYear + 1
          numMonthB = numMonthB - 6
          numMonthA = 0
        } else if (numMonthB + 6 >= 10) {
          numMonthA = 1
          numMonthB = numMonthB - 4
        } else {
          numMonthB = numMonthB + 6
        }
      } else if (numMonthA == 1) {
        numberYear = numberYear + 1
        numMonthA = 0
        numMonthB = numMonthB + 4
      }

      let ConversionTime = '' + numberYear + '-' + numMonthA + numMonthB + '-' + day
      this.form.setFieldsValue({
        conversionTime: ConversionTime,
      })
    },
    getEndContract(e) {
      console.log(e)
      let year = e.substr(0, 4)
      console.log(year)
      let day = e.substr(8, 2)
      let strMonthA = e.substr(5, 1)
      let strMonthB = e.substr(6, 1)
      let numMonthB = Number(strMonthB)
      let numMonthA = Number(strMonthA)
      let numberYear = Number(year)
      let contTerm = this.form.getFieldValue('contTerm')
      let mm = Number(e.substr(5, 2))

      if (mm + contTerm > 12) {
        if ((mm + contTerm) % 12 <= 9 && (mm + contTerm) % 12 > 0) {
          numMonthB = (mm + contTerm) % 12
          numMonthA = '0'
          numberYear = numberYear + Math.floor((mm + contTerm) / 12)
        }
        if ((mm + contTerm) % 12 >= 10) {
          numMonthB = (mm + contTerm) % 12
          numMonthA = ''
          numberYear = numberYear + Math.floor((mm + contTerm) / 12)
        }
        if ((mm + contTerm) % 12 == 0) {
          numMonthB = '12'
          numMonthA = ''
          numberYear = numberYear + (mm + contTerm) / 12
        }
      } else {
        numMonthB = mm + contTerm
        numMonthA = ''
      }

      //numberYear = numberYear + Number(contTerm)
      let endContract = '' + numberYear + '-' + numMonthA + numMonthB + '-' + day
      this.form.setFieldsValue({
        endContract: endContract,
      })
    },
    changeEndContract(e) {
      let beginContract = this.form.getFieldValue('beginContract')
      let year = beginContract.substr(0, 4)
      let day = beginContract.substr(8, 2)
      let strMonthA = beginContract.substr(5, 1)
      let strMonthB = beginContract.substr(6, 1)
      let numMonthB = Number(strMonthB)
      let numMonthA = Number(strMonthA)
      let numberYear = Number(year)

      let mm = Number(beginContract.substr(5, 2))

      if (mm + e > 12) {
        if ((mm + e) % 12 <= 9 && (mm + e) % 12 > 0) {
          numMonthB = (mm + e) % 12
          numMonthA = '0'
          numberYear = numberYear + Math.floor((mm + e) / 12)
        }
        if ((mm + e) % 12 >= 10) {
          numMonthB = (mm + e) % 12
          numMonthA = ''
          numberYear = numberYear + Math.floor((mm + e) / 12)
        }
        if ((mm + e) % 12 == 0) {
          numMonthB = '12'
          numMonthA = ''
          numberYear = numberYear + (mm + e) / 12
        }
      } else {
        numMonthB = mm + e
        numMonthA = ''
      }

      //numberYear = numberYear + e
      let endContract = '' + numberYear + '-' + numMonthA + numMonthB + '-' + day
      this.form.setFieldsValue({
        endContract: endContract,
      })
    },
    changeTimeStamp(timestamp) {
      if (timestamp == 0) {
        return ``
      }
      let time1 = new Date(Number(timestamp))
      let year = time1.getFullYear()
      let month = time1.getMonth() + 1
      let day = time1.getDate()
      month = month < 10 ? '0' + month : month
      day = day < 10 ? '0' + day : day
      return year + '-' + month + '-' + day
    },
  },
}
</script>
<style lang="less" scoped>
.ant-descriptions {
  border: 2px solid #d9d9d9;
  padding: 30px;
  margin-bottom: 20px;
  border-radius: 20px;
}
.wxcode {
  position: fixed;
  top: 20px;
  left: 20px;
}
</style>
